/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gap.item;

import com.buanalintas.bynga.Dictionary;
import com.buanalintas.bynga.Field;
import com.buanalintas.bynga.Page;
import com.gap.entities.GapMasterItem;

/**
 *
 * @author Yunita
 */
public class Item extends Page{
    private Field itemId;
    
    private Field itemName;
    
    private Field itemDiscount;
    

    public Item() {
        super();

        setTheClass(GapMasterItem.class);
        
        
        
        
        itemId = new Field();
        itemId.setName("itemId");
        itemId.setCaption("id");
        //religionId.setInfo("religion id");
        itemId.setListProperties(" align=\"left\" width=\"1%\" nowrap");
        itemId.setInputProperties(" size=\"20\"");        
        getFields().add(itemId);
        
        itemName = new Field();
        itemName.setName("itemName");
        itemName.setCaption("name");
        itemName.setRequired(true);
        itemName.setListProperties(" align=\"left\" width=\"60%\" nowrap");
        itemName.setInputProperties(" size=\"20\"");        
        getFields().add(itemName);
        
        itemDiscount = new Field();
        itemDiscount.setName("itemDiscount");
        itemDiscount.setCaption("discount percent");
        itemDiscount.setDefaultValue(0);
        itemDiscount.setListProperties(" align=\"right\" width=\"40%\" nowrap");
        itemDiscount.setInputProperties(" size=\"20\"");        
        getFields().add(itemDiscount);
        

        fillFields();
        getFieldsAdd().remove(itemId);
        getFieldsEdit().remove(itemId);
        getFieldsList().remove(itemId);
        
        setExportList(getClass().getResourceAsStream("ItemList.jasper"));
        setExport(getClass().getResourceAsStream("Item.jasper"));
    }
    
    @Override
    public void beforeExport() {
        getExportParams().put("title", Dictionary.getValue(this, "Item"));
    }

    @Override
    public void beforeExportMulti() {
        beforeExport();
    }
}
